<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">
	<xsl:output method="xml" indent="yes" />

	<xsl:template match="/">
		<FriendReport>
			<Summary>
				You have
				<xsl:value-of select="count(Friends/Friend)" />
				friends. You have
				<xsl:value-of select="count(Friends)" />
				friend containers.

				<FriendsByNickName>
					<xsl:for-each select="Friends">
						<xsl:for-each select="Friend">
							<xsl:sort select="@nick_name" />
							<xsl:copy-of select="." />
						</xsl:for-each>
					</xsl:for-each>
				</FriendsByNickName>

				<FriendsByName>
					<xsl:for-each select="Friends">
						<xsl:for-each select="Friend">
							<xsl:sort select="@name" />
							<xsl:copy-of select="." />
						</xsl:for-each>
					</xsl:for-each>
				</FriendsByName>

			</Summary>
		</FriendReport>
	</xsl:template>
</xsl:stylesheet>
